.bookmark-category {
    margin-bottom: 1rem;
    border: 1px solid rgba(0,0,0,.125);
    border-radius: 0.25rem;
}

.category-header {
    padding: 0.75rem 1rem;
    background-color: rgba(0,0,0,.03);
    border-bottom: 1px solid rgba(0,0,0,.125);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.category-header:hover {
    background-color: rgba(0,0,0,.06);
}

.category-content {
    padding: 1rem;
}

/* 修复书签项布局 */
.bookmark-item {
    padding: 0.75rem;
    border-bottom: 1px solid rgba(0,0,0,.125);
    min-width: 0; /* 防止子元素溢出 */
}

/* 添加书签容器样式 */
.bookmark-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap;
    flex-direction: row; /* 确保水平布局 */
    gap: 10px; /* 添加元素之间的间距 */
}

.bookmark-info {
    flex: 1 1 auto;
    overflow: hidden;
    margin-right: 10px;
    display: flex;
    align-items: center;
    min-width: 0; /* 确保内容可以收缩 */
    max-width: 70%; /* 增加最大宽度，但仍然给按钮留出空间 */
}

.bookmark-title {
    font-weight: 500;
    margin-bottom: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    max-width: calc(100% - 10px); /* 确保标题不会占用太多空间，给按钮留出空间 */
}

/* 确保按钮组与标题在同一行 */
.bookmark-actions {
    display: flex;
    gap: 0.25rem;
    flex: 0 0 auto;
    align-items: center;
    white-space: nowrap;
    margin-left: auto; /* 确保按钮组靠右对齐 */
    flex-wrap: nowrap;
    justify-content: flex-end; /* 确保按钮靠右对齐 */
}

.bookmark-url {
    display: none; /* 隐藏URL链接 */
    color: #6c757d;
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bookmark-actions button {
    padding: 0.25rem 0.4rem;
    font-size: 0.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px; /* 减小按钮最小宽度 */
    margin-left: 2px; /* 增加按钮之间的间距 */
}

/* 确保3D模型转换和爱给网按钮在同一行 */
.bookmark-actions button {
    display: inline-flex;
    align-items: center;
}

.bookmark-actions button i {
    margin-right: 2px;
}

/* 添加类别颜色样式 */
.category-header h5 {
    color: #009966; /* 绿色 */
    font-weight: 600;
}

/* 暗色主题适配 */
[data-bs-theme="dark"] .category-header h5 {
    color: #009966; /* 保持绿色 */
}

/* 确保类别标签有颜色 */
.category-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.25rem;
    background-color: #f8f9fa;
    color: #fd7e14;
    margin-right: 0.5rem;
    margin-bottom: 0;
    cursor: pointer;
}

.category-badge:hover {
    background-color: #e2e6ea;
}

.category-badge.active {
    background-color: #0d6efd;
    color: white;
}

/* 响应式布局调整 */
@media (max-width: 576px) {
    .bookmark-container {
        flex-wrap: nowrap;
        align-items: center;
        justify-content: space-between;
    }
    
    .bookmark-info {
        flex: 1 1 auto;
        min-width: 0;
        margin-right: 5px;
        margin-bottom: 0;
        max-width: 60%;
    }
    
    .bookmark-title {
        max-width: 100%;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        font-size: 0.9rem;
    }
    
    .bookmark-actions {
        flex: 0 0 auto;
        flex-wrap: nowrap;
        margin-left: auto;
        justify-content: flex-end;
        max-width: 40%;
    }
    
    .bookmark-actions button {
        padding: 0.2rem 0.3rem;
        min-width: auto;
        font-size: 0.7rem;
    }
    
    .bookmark-actions button i {
        margin-right: 0;
    }
}

/* 暗色主题适配 */
[data-bs-theme="dark"] .bookmark-category {
    border-color: rgba(255,255,255,.125);
}

[data-bs-theme="dark"] .category-header {
    background-color: rgba(255,255,255,.03);
    border-color: rgba(255,255,255,.125);
}

[data-bs-theme="dark"] .category-header:hover {
    background-color: rgba(255,255,255,.06);
}

[data-bs-theme="dark"] .bookmark-item {
    border-color: rgba(255,255,255,.125);
}

[data-bs-theme="dark"] .bookmark-url {
    color: #adb5bd;
}

[data-bs-theme="dark"] .category-badge {
    background-color: #343a40;
    color: #f8f9fa;
}

[data-bs-theme="dark"] .category-badge:hover {
    background-color: #495057;
}

/* 折叠图标 */
.category-toggle-icon::after {
    display: inline-block;
    content: "";
    width: 0.5rem;
    height: 0.5rem;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    margin-left: 0.5rem;
    transform: rotate(45deg);
    transition: transform 0.2s ease-in-out;
}

.category-header.collapsed .category-toggle-icon::after {
    transform: rotate(-45deg);
}